<template>
  <div class="login_page">
    <div class="page_left" v-motion-pop>
      <div class="login_title">
        <h2>NiuAdmin</h2>
        <h4>{{ $t('login.slogan') }}</h4>
        <p>{{ $t('login.describe') }}</p>
      </div>
      <LoginBanner />
    </div>
    <!-- 右侧登录表单区域 -->
    <div class="page_right">
      <!-- 设置 -->
      <div class="login_config">
        <!-- 切换系统主题 -->
        <AppDarkModeToggle v-motion-roll-left style="margin-right: 24px" />
        <!-- 切换系统语言环境 -->
        <AppLocalePicker v-motion-roll-left />
      </div>
      <!-- 登录表单容器，通过 useLogin 来切换表单 -->
      <div class="formWrapper">
        <!-- 登录表单 -->
        <LoginForm />
        <!-- 注册表单 -->
        <RegisterForm />
        <MobileForm />
        <QrCodeForm />
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { LoginBanner, LoginForm, RegisterForm, MobileForm, QrCodeForm } from './cnps'
import { AppDarkModeToggle, AppLocalePicker } from '@/components/Application'

export default defineComponent({
  components: {
    LoginBanner,
    LoginForm,
    RegisterForm,
    AppDarkModeToggle,
    AppLocalePicker,
    MobileForm,
    QrCodeForm
  }
})
</script>

<style lang="scss" scoped>
.login_page {
  width: 100%;
  height: 100%;
  display: flex;
  background: url(../../../public/resource/img/bg_white.png);

  .page_left {
    width: 50%;
    background: url(../../../public/resource/img/login-bg.svg);
    background-position: 100%;
    background-repeat: no-repeat;
    background-size: auto 100%;
    position: relative;
    overflow: hidden;

    .login_title {
      width: 100%;
      position: absolute;
      top: 0;
      left: 0;
      color: #fff;
      padding: 40px;

      h2 {
        font-size: 26px;
      }

      h4 {
        font-size: 18px;
        margin-top: 10px;
        font-weight: normal;
      }

      p {
        font-size: 14px;
        margin-top: 10px;
        line-height: 1.8;
        color: rgba(255, 255, 255, 0.6);
      }
    }
  }

  .page_right {
    flex: 1;
    display: flex;

    .login_config {
      position: absolute;
      top: 20px;
      right: 20px;
    }

    .formWrapper {
      width: 400px;
      margin: auto;
      padding: 20px 0;
    }
  }
}

::v-deep(.el-divider__text) {
  background: url(../../../public/resource/img/bg_white.png);
}
</style>
